from selenium import webdriver
from selenium.webdriver.chrome.webdriver import WebDriver


class BasePage:
    """
    basepage提供公共的封装方法，就是和页面逻辑无关的封装
    比如解决driver初始化的问题
    """
    url = ""

    def __init__(self, driver=None):
        if driver is None:
            chrome_arg = webdriver.ChromeOptions()
            #加入调试地址
            # chrome_arg.debugger_address = '127.0.0.1:9222'
            #实例化driver对象
            self.driver = webdriver.Chrome(options=chrome_arg)
            self.driver.implicitly_wait(10 )
            #打开企业微信首页
            self.driver.get(self.url)
            self.driver.implicitly_wait(10)
        else:
            #将self.driver 添加一个webdriver注解，注解本身没有赋值作用
            self.driver: WebDriver=driver

        #点击添加成员